package com.ruoyi.teaching.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teaching.mapper.TeachingCourseMapper;
import com.ruoyi.teaching.domain.TeachingCourse;
import com.ruoyi.teaching.service.ITeachingCourseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 教务课程Service业务层处理
 * 
 * @author william
 * @date 2022-10-10
 */
@Service
public class TeachingCourseServiceImpl implements ITeachingCourseService 
{
    @Autowired
    private TeachingCourseMapper teachingCourseMapper;

    /**
     * 查询教务课程
     * 
     * @param courseId 教务课程主键
     * @return 教务课程
     */
    @Override
    public TeachingCourse selectTeachingCourseByCourseId(Long courseId)
    {
        return teachingCourseMapper.selectTeachingCourseByCourseId(courseId);
    }

    /**
     * 查询教务课程列表
     * 
     * @param teachingCourse 教务课程
     * @return 教务课程
     */
    @Override
    public List<TeachingCourse> selectTeachingCourseList(TeachingCourse teachingCourse)
    {
        return teachingCourseMapper.selectTeachingCourseList(teachingCourse);
    }

    /**
     * 查询所有教务课程
     *
     * @return 教务课程
     */
    public List<TeachingCourse> selectTeachingCourseAll(){
        return teachingCourseMapper.selectTeachingCourseAll();
    };

    /**
     * 新增教务课程
     * 
     * @param teachingCourse 教务课程
     * @return 结果
     */
    @Override
    public int insertTeachingCourse(TeachingCourse teachingCourse)
    {
        teachingCourse.setCreateTime(DateUtils.getNowDate());
        return teachingCourseMapper.insertTeachingCourse(teachingCourse);
    }

    /**
     * 修改教务课程
     * 
     * @param teachingCourse 教务课程
     * @return 结果
     */
    @Override
    public int updateTeachingCourse(TeachingCourse teachingCourse)
    {
        teachingCourse.setUpdateTime(DateUtils.getNowDate());
        return teachingCourseMapper.updateTeachingCourse(teachingCourse);
    }

    /**
     * 批量删除教务课程
     * 
     * @param courseIds 需要删除的教务课程主键
     * @return 结果
     */
    @Override
    public int deleteTeachingCourseByCourseIds(String courseIds)
    {
        return teachingCourseMapper.deleteTeachingCourseByCourseIds(Convert.toStrArray(courseIds));
    }

    /**
     * 删除教务课程信息
     * 
     * @param courseId 教务课程主键
     * @return 结果
     */
    @Override
    public int deleteTeachingCourseByCourseId(Long courseId)
    {
        return teachingCourseMapper.deleteTeachingCourseByCourseId(courseId);
    }
}
